<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simpla Admin</title>

<include file="Admin:Resources" />

</head>
<body>
	<div id="body-wrapper"> 
		<div id="main-content"> 
			


			<div class="content-box">
				
				<div class="content-box-header">
					
					<h3>正在为:&nbsp;&nbsp;<span style="color:red">{$role_info.name}</span>&nbsp;&nbsp;配置权限</h3>
					
					<ul id="my_tab">
						<li><a href="#" ></a></li>
								
					</ul>
					<div class="clear"></div>
				</div> 
			
			<form action="__APP__/Admin/setAccess" method="POST" enctype="multipart/form-data"    >
				<div class="content-box-content add_type" >
				
					<?php foreach($node_info as $val){?>
						<li style="list-style:none; margin-top:16px; text-indent:<?php echo $val['level']*20;?>px; <?php if($val['level']==3){echo 'float:left';}else{echo 'clear:both';}?>"  >
							<input class="role_list" style="height:15px;" id="<?php echo $val['id']?>" type="checkbox" name="access[]" value="<?php echo $val['id']?>_<?php echo $val['level']?>" pid=<?php echo $val['pid']?> level=<?php echo $val['level'];?> <?php if($val['access']==1){echo 'checked="checked"';}?> /> <span style="font-size:13px;"><?php echo $val['title']?></span>
						</li>
					<?php } ?>
					<br>
					<input type="hidden" value="<?php echo $id; ?>" name="role_id" />
					<p  style="margin-top:40px;"><input style="margin-left:350px; margin-top:40px; height:26px;" class="button" type="submit" value="提交"  /></p>
				
				</div>
			</form>
				
			</div>
			
			<div class="clear"></div>
<script>
	$('.role_list').click(function(){
		
		var level=$(this).attr('level');
		if(level==1){
			var str='_';
			var inputs=$('input[value*='+str+']');
			$(this).attr('checked')?inputs.attr('checked',true):inputs.removeAttr('checked');
		}
		
		if(level==2){
			//alert($(this).attr('pid'));
			var id=$(this).attr('id');
			var inputs=$('input[pid='+id+']');
			$(this).attr('checked')?inputs.attr('checked',true):inputs.removeAttr('checked');
		}
		if(level==3){ 
			if($(this).attr('checked')){ 
				var pid=$(this).attr('pid');
				var inputs=$('input[id='+pid+']');
				inputs.attr('checked',true);
				
				var pid=inputs.attr('pid');
				var inputs=$('input[id='+pid+']');
				inputs.attr('checked',true);
			}
		}
	});
</script>
			
			
		</div> 

	</div>
	
</body>
</html>
